package com.jeasonzhao.commons.parser.lex;

import com.jeasonzhao.commons.basic.StringPair;

public class KnownConfiguration
{
    private KnownConfiguration()
    {
        super();
    }

    public static class JSONConfiguration extends LexTokenizerConfig
    {
        private final static JSONConfiguration m_instance = new JSONConfiguration();
        public final static JSONConfiguration getInstance()
        {
            return m_instance;
        }

        private JSONConfiguration()
        {
            this.setSpecialSymbols(new String[]
                                   {"||","&&",">=","<=","==","!=","<>"});
            this.setNameExtraCharacter('_');
        }
    }

    public static class JAVAConfiguration extends LexTokenizerConfig
    {
        private final static JAVAConfiguration m_instance = new JAVAConfiguration();
        public final static JAVAConfiguration getInstance()
        {
            return m_instance;
        }

        private JAVAConfiguration()
        {
            this.setLongNameDelimiters(".");
            this.setNamePrefixes('_','$');
            this.setCommentBlockPairs(new StringPair[]
                                      {new StringPair("/*","*/")});
            this.setLineCommentFlags("//");
            this.setSpecialSymbols(new String[]
                                   {"||","&&",">=","<=","==","!=","<>"});
        }
    }

    public static class Expression extends LexTokenizerConfig
    {
        private final static Expression m_instance = new Expression();
        public final static Expression getInstance()
        {
            return m_instance;
        }

        private Expression()
        {
            this.setLongNameDelimiters(".");
            this.setNamePrefixes(new char[]
                                 {'@','#','$','_'});
            this.setCommentBlockPairs(new StringPair("/*","*/"));
            this.setLineCommentFlags(new String[]
                                     {"--","//"});
            this.setSpecialSymbols(new String[]
                                   {"||","&&",">=","<=","==","!=","<>"});
        }
    }

    public static class SQL92 extends LexTokenizerConfig
    {
        private final static SQL92 m_instance = new SQL92();
        public final static SQL92 getInstance()
        {
            return m_instance;
        }

        private SQL92()
        {
            this.setLongNameDelimiters(".");
            this.setNamePrefixes(new char[]
                                 {':','@','#','$','_'});
            this.setCommentBlockPairs(new StringPair("/*","*/"));
            this.setLineCommentFlags("--");
            this.setSpecialSymbols(new String[]
                                   {"||","&&",">=","<=","==","!=","<>"});

        }
    }

    public static class CPPConfiguration extends LexTokenizerConfig
    {
        private final static CPPConfiguration m_instance = new CPPConfiguration();
        public final static CPPConfiguration getInstance()
        {
            return m_instance;
        }

        private CPPConfiguration()
        {
            this.setLongNameDelimiters(new String[]
                                       {".","::","->"});
            this.setNamePrefixes(new char[]
                                 {'_','#','~'});
            this.setCommentBlockPairs(new StringPair("/*","*/"));
            this.setLineCommentFlags("//");
            this.setSpecialSymbols(new String[]
                                   {"||","&&",">=","<=","==","!=","<>"});
            this.setSpecialNamePairs(new StringPair("<",">"));
        }
    }

    public static class CSSConfiguration extends LexTokenizerConfig
    {
        private final static CSSConfiguration m_instance = new CSSConfiguration();
        public final static CSSConfiguration getInstance()
        {
            return m_instance;
        }

        private CSSConfiguration()
        {
            this.setLongNameDelimiters(".");
            this.setNamePrefixes('_','$','#','.');
            this.setNameExtraCharacter('-');
            this.setCommentBlockPairs(new StringPair[]
                                      {new StringPair("/*","*/")});
            //this.setLineCommentFlags("//");
            this.setSpecialSymbols(new String[]
                                   {"||","&&",">=","<=","==","!=","<>"});
        }
    }
}
